﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Collections;

namespace OrganizationName.Factory.LifeTimeContracts
{
    public class ThreadLifeTimeContract : KeyedStorageLifeTimeContract
    {
        [ThreadStatic]
        private static Hashtable _Data = new Hashtable();

        protected override object GetData(string key)
        {
            return _Data[key];
        }

        protected override void SetData(string key, object instance)
        {
            _Data[key] = instance;
        }

        public override object SyncRoot
        {
            get
            {
                return new object();
            }
        }
    }
}
